package cn.com.wantools.service.provider;

import cn.com.wantools.model.unitconvert.UcConvertType;
import cn.com.wantools.model.unitconvert.UcUnitType;
import cn.com.wantools.service.UcConvertTypeService;
import cn.com.wantools.service.UcUnitTypeService;
import io.jboot.aop.annotation.Bean;
import io.jboot.db.model.Columns;
import io.jboot.service.JbootServiceBase;

import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;

@Bean
public class UcConvertTypeServiceProvider extends JbootServiceBase<UcConvertType> implements UcConvertTypeService {

    @Override
    public List<UcConvertType> queryAllConvertType() {
        return findAll()
                .stream()
                .filter(a -> (null != a.getVisibleFlag() && a.getVisibleFlag().equals(1)))
                .sorted((x, y) -> x.getOrders().compareTo(y.getOrders()))
                .collect(Collectors.toList());
    }
}
